package com.pktechan.manage.enumeration;

/**
 * 状态变化类型枚举
 */
public enum StatusFlowTypeEnum {

    // 业务种类 1、订单状态; 2、佣金生成状态; 3、佣金提现状态

    ORDER(1, "订单状态"),
    COMMISSION_GENERATION(2, "佣金生成状态"),
    COMMISSION_WITHDRAWAL(3, "佣金提现状态"),
    CUST_CARRIAGE_WITHDRAWAL(4, "运费提现状态");

    private Integer code;
    private String name;

    StatusFlowTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    /**
     * 根据状态代码获得状态名称
     * @param code 状态代码
     * @return 状态名称
     */
    public static String getNameByCode(Integer code) {
        for (StatusFlowTypeEnum statusEnum : StatusFlowTypeEnum.values()) {
            if (statusEnum.code.equals(code)) {
                return statusEnum.name;
            }
        }
        return null;
    }
}
